import request from '@/utils/request';

/**
 * 充值记录
 * @param params 查询条件
 */

export async function topUpRecordsList(params) {
  const res = await request.get('/massage/topUpRecords/page', {
    params
  });

  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 获取充值记录头部
export async function getTopUpRecordsHead(params) {
  const res = await request.get('/massage/topUpRecords/getTopUpRecordsHead', {
    params
  });

  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 *  充值记录删除
 * @param params 查询条件
 */

export async function topUpListDelete(id) {
  const res = await request.delete('/massage/topUpRecords/' + id);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 *  充值记录批量删除
 * @param params 查询条件
 */
export async function topUpListDeleteBatch(data) {
  const res = await request.delete('/massage/topUpRecords/batch', {
    data
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
